const mySql = require('mysql2')

//创建数据库连接
const connection = mySql.createConnection({
    host:"localhost",
    user:"root",
    password:"133435",
    database:"companydb",
    multipleStatements:true
})
console.log('success')
//断开
// connection.end()
// console.log('end')

// 增加
connection.execute("insert into company(`name`,id) values('戴姆勒公司' , 7)" , function (err,result){
    console.log(result)
})

// 增加
// connection.query("insert into company(`name`,id) values('宝马集团' , 6)" , function (err,result){
//     console.log(result)
// })

// 修改
// connection.query("update company set `name`='宝马中国' where id=6 " ,function (err,result){
//     console.log(result)
// } )

// 删除
// connection.query("delete from company where id=6 " ,function (err,result){
//     console.log(result)
// } )

// 查询
// connection.query("SELECT * FROM `company`;", function (err , result){
//         console.log(result)
//     }
// )

